import { MockMethod } from 'vite-plugin-mock';
import { resultSuccess } from '../_util';
import { mock } from 'mockjs';

const memberList = mock({
  'data|30': [
    {
      memberId: '@increment',
      username: '18306561056',
      nickname: '18306561056',
      email: '',
      status: 1,
      avatar: '',
      memberLevel: 1,
      memberLevelName: '普通会员',
      memberLabelText: '80,3',
      lastLoginTime: '@date(yyyy-MM-dd HH:mm:ss)',
      createTime: '@date(yyyy-MM-dd HH:mm:ss)',
      point: 0,
      balance: '0.00',
      orderMoney: '0.00',
      orderNum: 0,
      isDelete: 0,
    },
  ],
});

const memberInfo = mock({
  memberId: '@increment',
  memberName: 'CONVERSE匡威官方 All Star时尚百搭帆布鞋女鞋新款休闲鞋571867C',
  introduction: '时尚百搭帆布鞋女鞋新款休闲鞋571867C',
  memberImageList: [
    'http://www.lvais.com/upload/2022/11/15/20221115112138641.jpg',
    'http://www.lvais.com/upload/2019/08/07/20190807100514186.jpg',
  ],
  keyword: '是客户交,深刻的回复',
  categoryId: [1, 2, 3],
  memberState: 2,
  price: '499.00',
  memberStock: 400,
  memberStockAlarm: 0,
  createTime: '@date(yyyy-MM-dd HH:mm:ss)',
  saleNum: 0,
  isVirtual: 0,
  memberClass: 1,
  memberClassName: '实物商品',
  isFenxiao: 0,
  fenxiaoType: 1,
  promotionAddon: '',
  skuId: 15,
  isConsumeDiscount: 0,
  discountConfig: 0,
  discountMethod: '',
  sort: '@integer(1,20)',
  labelId: 0,
  labelName: '',
  isDelete: 0,
  virtualDeliverType: '',
  //新增
  memberStateText: '销售中',
});

export default [
  //分页
  {
    url: '/mock-api/v1/member/page',
    timeout: 100,
    method: 'post',
    response: () => {
      return resultSuccess({ list: memberList.data.slice(0, 6), total: 10 });
    },
  },
  {
    url: '/mock-api/v1/member/info',
    timeout: 100,
    method: 'post',
    response: () => {
      return resultSuccess(memberInfo);
    },
  },
] as MockMethod[];
